<template>
  <div>
    <div class="navbar">
      <van-nav-bar
        title="推荐收藏详情"
        @click-left="$router.push('/mine/collection')"
        :border="false"
      >
        <template #left>
          <van-icon name="arrow-left" color="black" size="18px" />
        </template>
      </van-nav-bar>
    </div>
    <h2>4</h2>
    <router-view />
  </div>
</template>

<script>
import { mapState } from "vuex";
import { getRecom } from "@/api/request";
import recommendDetail from "@/components/recommendDetail.vue";
export default {
  data() {
    return {
      // 接收路由参数
      rid: this.$route.params.rit,
      item: [],
    };
  },
  methods: {
    a() {
      getRecom({ uname: this.$store.state.user.uname }).then((res) => {
        console.log(res);
        console.log(9999);

        this.item = res.data.message;
        console.log(this.item);
      });
    },
  },
  mounted() {
    this.a();
    console.log(this.rid);
  },
  components: {
    recommendDetail,
  },
  computed: {
    //mapState将开放vuex中保存的user对象到当前组件的计算属性中
    //这样，在当前组件内部,就可以直接使用user来访问vuex中的user
    ...mapState(["user"]),
  },
};
</script>

<style lang="scss" scoped>
</style>